package me.whf.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;

import me.whf.model.Account;
import me.whf.model.AdvanceAccount;
import me.whf.model.Employee;
import me.whf.model.EnterpriseMapping;
import me.whf.model.Logger;

public class Utils {

	public enum ActionType {CREATE_ACCOUNT, DEPOSIT, WITHDRAW, QUERY, QUERY_TIMELINE, TRANSFER, CHANGE_PASSWORD, ADD_ENTERPRISE_OPERATOR, DESTORY}
	public enum UserType {COMMON, VIP, ENTERPRISE}
	public enum AccountType {FIXED, PERIOD}
	public enum EmployeeType {RECEPTION, MANAGER, HEADMANAGER, ADMINISTRATOR}
	public enum Storage {FILE, DATABASE}
	
	public static Map<String, Account> accounts = new HashMap<String, Account>();
	public static Map<String, AdvanceAccount> vipstuff = new HashMap<String, AdvanceAccount>();
	public static Map<String, ArrayList<EnterpriseMapping>> enterprises = new HashMap<String, ArrayList<EnterpriseMapping>>();
	
	public static Map<String, ArrayList<Logger>> loggers = new HashMap<String, ArrayList<Logger>>();
	public static Map<String, ArrayList<String>> apartments = new HashMap<String, ArrayList<String>>();
	
	public static Map<String, Employee> employees = new HashMap<String, Employee>();
	public static Storage storage = Storage.FILE;

	public static String generateRandomAccount() {
        String base = "0123456789";   
        Random random = new Random();   
        StringBuffer sb = new StringBuffer();   
        for (int i = 0; i < 5; i++) {   
            int number = random.nextInt(base.length());   
            sb.append(base.charAt(number));   
        }   
        return sb.toString();   
	}
}
